<template>
<div>

    <div><h1>添加标签</h1></div>
    <div v-width="400" class="addt">
        <br>
        <div>
            发货单号&nbsp;&nbsp;<input type="text" v-model="gnum">
        </div>
        客户信息
        <select name="" v-model="cid">
		    <option v-for="item in param" :value="item.id">{{item.cname}}</option>
        </select><br>
        货物类型
        <select name="" v-model="gid">
		    <option v-for="item in genrelist" :value="item.id">{{item.name}}</option>
        </select>
        <br>
       
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <Button color="primary"  @click="submit">确认添加</Button>
  </div>
</div>
</template>

<style>
    .addt {
    background-color: rgb(219, 221, 224);
    line-height: 60px;
    border-radius: 10px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);
  }
</style>

<script>
import { addgoods_post,showclient_post,genreshow_post } from './axios_api/api';
export default {
  data() {
    return {
        param:[],
        genrelist:[],
        gnum:"",
        select:"",
        cid:"",
        uid:"",
        gid:""
    };
  },
  mounted(){
      this.showclient();
      this.genreshow();
  },
  methods: {
      submit(){
          var type = localStorage.getItem('type')
          var data = {gnum:this.gnum,id:this.cid,gid:this.gid}
          if(type==5){
              addgoods_post(data).then(resp=>{
                this.$Message(resp.message)
            })
          }else{
              this.$Message("权限不足")
          }
      },
      showclient(){
          showclient_post().then(resp=>{
              this.param = resp.client_list;
            //   console.log(this.param);
          })
      },
        genreshow(){
          genreshow_post().then(resp=>{
              this.genrelist = resp.genrelist;
              console.log(this.genrelist);
          })
      },

  }
};
</script>
